﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using PrimativeViews;
using StandardFramework;

namespace StandardLibraryXNA
{
    public class BoundComponentXNAGraphics : BaseComponent
    {
        BoundComponentXNAData _bound;

        LineView _line;

        SpriteBatch _spriteBatch;

        public bool Visible
        {
            get { return _line.Visible; }
            set { _line.Visible = value; }
        }

        public Color Color
        {
            get { return _line.Color; }
            set { _line.Color = value; }
        }

        public BoundComponentXNAGraphics(GraphicsDevice gD, SpriteBatch spriteBatch, BoundComponentXNAData bound, Color color)
        {
            _line = new LineView(gD);
            Visible = true;
            Color = color;

            _spriteBatch = spriteBatch;
            _bound = bound;
        }


        public override void Update(float dtime)
        {
            _line.CreateBox(new Vector2(_bound.BoundXNA.Left, _bound.BoundXNA.Top), new Vector2(_bound.BoundXNA.Right, _bound.BoundXNA.Bottom));

            if(Visible)
                _line.Draw(_spriteBatch);
        }
    }
}
